﻿using KFC.MonAnF;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace KFC
{
    public partial class ChonLoaiPhanAnForm : Form
    {
        private MonAn _monAn;

        public MonAn MonAn
        {
            get { return _monAn; }
            //set { _monAn = value; }
        }

        private List<MonAn> dsLoaiMonAn;

        public List<MonAn> DsLoaiMonAn
        {
            //get { return dsLoaiMonAn; }
            set { dsLoaiMonAn = value; }
        }

        public ChonLoaiPhanAnForm()
        {
            InitializeComponent();
            MonAnFactory monAnFactory = new MonAnFactory();
            dsLoaiMonAn = monAnFactory.Samples;
        }

        private void ChonLoaiPhanAn_Load(object sender, EventArgs e)
        {
            List<string> dsTenLoaiMonAn = new List<string>();
            foreach(MonAn loaiMonAn in dsLoaiMonAn)
            {
                dsTenLoaiMonAn.Add(loaiMonAn.LayTenLoaiDoiTuong());
            }
            comboBoxLoaiMonAn.DataSource = dsTenLoaiMonAn;
        }

        private void button1_Click(object sender, EventArgs e)
        {
            int idx = comboBoxLoaiMonAn.SelectedIndex;
            _monAn = dsLoaiMonAn[idx];
            this.Close();
        }
    }
}
